<template>
  <div ref="rootRef">
    <slot />
  </div>
</template>

<script>
import useScroll from '@/components/base/scroll/use-scroll'
import { ref } from 'vue'

export default {
  props: {
    // 允许点击
    click: {
      type: Boolean,
      default: true
    },
    // https://better-scroll.github.io/docs/zh-CN/guide/base-scroll-options.html#probetype
    // 是否需要开启滚动位置的监听
    probeType: {
      type: Number,
      default: 0
    }
  },
  setup (props, { emit }) {
    const rootRef = ref(null)

    const scroll = useScroll(rootRef, props, emit)
    // 子组件中包含scroll对象，父组件可以访问到 scrollRef.value.scroll
    return { rootRef, scroll }
  }
}
</script>

<style lang="scss" scoped></style>
